Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

iOS PWA improvments #89

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Pasithea0
Copy link
Contributor

@Pasithea0 Pasithea0 commented Aug 15, 2024

This aims to solve most of the problems with the iOS PWA.

Apple has restricted the use of many features for PWAs such as, not supporting Picture in Picture (PiP), breaking the functionality of the "standalone" display property, and always showing the home indicator on iPhone X and beyond.

Preview: https://pwa-improvements.envyflix.pages.dev/

Changes:

Disable PiP and Fullscreen for iOS PWA

  • Disabled PiP and Fullscreen on iOS PWA only to mitigate Apple breaking the functionality, thus making the buttons useless.

Add info button for iOS PWA

  • Added a button in place of the Fullscreen button that shows an alert explaining why the PiP and Fullscreen buttons were removed.
Screenshot 2024-08-15 at 2 29 31 PM Screenshot 2024-08-15 at 2 29 52 PM

Add Widescreen button

  • Due to the Fullscreen feature being disabled, the user can no longer fill their screen (remove letterboxing), so I reimplemented the feature back into the player.
Screenshot 2024-08-15 at 2 31 44 PM
widescreen_sample-1.mov
  • I also made this a secret feature for desktop, only shown when holding the "SHIFT" key.
Screen.Recording.2024-08-15.at.2.44.50.PM.mov

Fix top padding and safe areas for iOS PWA

  • The iOS PWA has an oversight that ignores the notch area, so I added safe areas for top elements.

BEFORE
Screenshot 2024-08-15 at 2 27 58 PM

AFTER
Screenshot 2024-08-15 at 2 28 26 PM

  • I have read and agreed to the code of conduct.
  • I have read and complied with the contributing guidelines.
  • I have tested all of my changes.
  • Enter discord user: .pasithea (we require this for the contributor role)

Explains why PiP and Fullscreen are disabled.

*Needs translations
*Primarily adds a Widescreen button to replace a native iOS fullscreen feature. (Due to it being disabled now)

Also available by holding shift and pressing the fullscreen button on desktop.
@ztpn
Copy link
Member

ztpn commented Aug 16, 2024

Fucking apple

noname25495 added a commit to noname25495/CineWhirl that referenced this pull request Aug 18, 2024
This reverts commit 1a36d96.

Reverted due to it disabling pull to refresh on mobile :(
@Pasithea0
Copy link
Contributor Author

Revert "Disable scrolling in player" due to disabling mobile pull to refresh feature.
Good to merge.


function IosPwaLimitations() {
const showAlert = () => {
alert(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't be using this
please do smth better like a modal that also is themed properly

import { VideoPlayerButton } from "@/components/player/internals/Button";

export function Widescreen() {
// Add widescreen status
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Widescreen isn't a replacement/alternative to fullscreen
This also seems very unfinished
so we look into how add widescreen properly later

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now please remove this

@@ -20,6 +22,26 @@ export function PlayerPart(props: PlayerPartProps) {
const { isMobile } = useIsMobile();
const isLoading = usePlayerStore((s) => s.mediaPlaying.isLoading);

// Detect if running as a PWA on iOS
const isIOSPWA =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just make this a separate hook in /hooks

window.matchMedia("(display-mode: standalone)").matches;

// Detect if Shift key is being held
const [isShifting, setIsShifting] = useState(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has to go since we aren't adding widescreen for now

@@ -116,18 +138,41 @@ export function PlayerPart(props: PlayerPartProps) {
<Player.Settings />
</>
) : null}
<Player.Fullscreen />
{/* Fullscreen on when not shifting */}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, all this has to go

<Player.Fullscreen />
{/* Disable for iOS PWA */}
{!isIOSPWA && (
<div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just do

{!isIOSPWA && (<Player.Fullscreen />)}

)}
{/* Add info for iOS PWA */}
{isIOSPWA && (
<div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants